<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <style>
      .obj1 {
        color: red;
        font-size: 16px;
        background-color: skyblue;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <h1 :style="styleobj1">v-bind 直接绑定样式的基本用法</h1>
      <hr />
      <h1 :style="{'color':varPink,'font-size':font}">v-bind 直接绑定样式的基本用法</h1>
      <hr>
      <h1 :class="myclass">v-bind 直接绑定样式的基本用法 class</h1>
      <hr>
      <h1 :style="[obj1,{'font-size': font ? font : '30px'}]">数组加对象</h1>
    </div>
    <script src="./vue.js"></script>
    <script>
      var vm = new Vue({
        el: "#app",
        data: {
          obj1: {
            color: "red",
            fontSize: "16px",
            backgroundColor: "skyblue",
          },
          varPink: "pink",
          font: "100px",
          flag: true,
          styleobj1: {
            color: "gold",
          },
          myclass: "obj1"
        },
        methods: {},
      });
    </script>
  </body>
</html>
